package com.eight.controller;

import com.eight.annotation.Login;
import com.eight.service.AccountService;
import com.eight.vo.ComResult;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

/**
 * @Description: 客户登录的controller类
 * @Author: Van.Planifolia
 * @CreateTime: 2023-02-25  10:34
 * @Version: 1.0
 */
@RestController
public class AccountLogin {
    @Resource(name = "accountService")
    private AccountService accountService;

    /**
     * 客户登录的Controller
     * @param username 客户的名字
     * @param password 客户的密码
     * @return 查询出来的结果
     */
    @GetMapping("/login/account/{username}/{password}")
    public ComResult accountLogin(@PathVariable String username, @PathVariable String password){
        return accountService.getAccountBy(username, password);
    }

    /**
     * 客户登出的方法
     * @return 客户登出的方法
     */
    @GetMapping("/login/account/logout")
    public ComResult accountLogin(){
        return accountService.logout();
    }

}
